/**
 * Copyright (c) 2002-2011 旭鸣信息
 * All rights reserved. 
 * File：FileUploadImgInfoSave.java
 * History:
 *       2012-2-12: Initially created, tangkf.
 */
package com.xteam.web.controller.upload;

import java.io.IOException;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.fileupload.FileItem;

import com.tangkf.utils.excel.ExcelUtils4JXL;
import com.tangkf.utils.fileupload.FileUploadUtils;

/**
 * @author tangkf ---2012-2-12
 */
public class ExcelProcesser implements IUploadProcess {

	/**
	 * 处理excel文件的类
	 * @see IUploadProcess.mystic.web.former.fileupload.FileUploadProcess#process(org.apache.commons.fileupload.FileItem, java.lang.String)
	 */
	public String process(HttpServletRequest request, HttpServletResponse response, FileUploadUtils fuu, FileItem fileItem, String... path) {
		try {
			ExcelUtils4JXL jxl	= new ExcelUtils4JXL(fileItem.getInputStream());
			List<List<Object>> excel	= jxl.getExcelSheet(0);
			for(int i=0;i<excel.size();i++){
				for(Object obj:excel.get(i)){
					System.out.print(obj+"，");
				}
				System.out.println();
			}
		} catch (IOException e) {
			System.err.println("excel 读取错误："+e.getLocalizedMessage());
		}
		return null;
	}

}
